#!/bin/bash

eval set -- $(getopts -n $0 -o "-cls" -- "$@")

declare c l s 
declare -a url
while [ $# -gt 0 ] ; do
        case "$1" in
                -c) c=1 ; shift ;;
                -s) s=1 ; shift ;;
                -l) l=1 ; shift ;;
                --) shift ;;
                -*) echo "bad option '$1'" ; exit 1 ;;
                *) url=("${url[@]}" "$1") ; shift ;;
         esac
done

if [ ${#url} -eq 0 ] ; then
        echo 'should be formatted as: url -[cls] <url address>'
        exit 1
fi

if [[ -z "$c" && -z "$l" && -z "$s" ]]; then
	echo 'you must enter at least one argument.'
	exit 1
fi 

#this is for testing
[ ! -z "$c" ] && echo "c on"
[ ! -z "$l" ] && echo "l on"
[ ! -z "$s" ] && echo "s on"

echo "input URL: ${url[@]}"
